package tech.aistar.mapper;

import org.apache.ibatis.annotations.*;
import tech.aistar.pojo.TicketType;

import java.util.List;
@Mapper
public interface TicketTypeMapper {

    @Select("select price from ticket_type where attraction_id=#{attraction_id} and name=#{name}")
    Double getPriceByAttractionAndName(@Param("attraction_id") Integer attraction_id,@Param("name") String name);

    @Select("select * from ticket_type where id=#{id}")
    TicketType getById(Integer id);

    @Delete("delete from ticket_type where id=#{value}")
    int delById(Integer id);

    @Insert("insert into ticket_type(attraction_id,name,price) values(#{attractionId},#{name},#{price})")
    int save(TicketType ticketType);

    @Update("update ticket_type set attraction_id=#{attractionId},name=#{name},price=#{price} where id=#{id}")
    int update(TicketType ticketType);
}
